package com.creator.pangu.biz.controller;

import com.creator.pangu.biz.entity.HelloWorld;
import com.creator.pangu.biz.service.IHelloWorldService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ljj
 * @since 2023-06-09
 */
@RestController
@RequestMapping("/helloWorld")
public class HelloWorldController {

    @Resource
    private IHelloWorldService helloWorldService;

    @GetMapping("/test")
    @PreAuthorize("hasAnyAuthority('sys:helloworld:read')")
    public List<HelloWorld> test(){
        return helloWorldService.list();
    }


    @GetMapping("/test2")
    @PreAuthorize("hasAnyAuthority('sys:helloworld:list')")
    public List<HelloWorld> test2(){
        return helloWorldService.list();
    }
}
